<?php
/**
 * bs多规格sku商城系统
 * ============================================================================
 * 版权所有 2024-2099 wltx666.com，并保留所有权利。
 * 网站地址: https://wltx666.com
 * ============================================================================
 * Author: 草上飞
 * Email: wltx@alipay168.cn
 * QQ: 2719875001
 * Date: 2024/12/15
 * 描述:
 */

use think\facade\Route;

//更新版本检测
Route::get('update', 'app\api\controller\Update@check');
Route::get('web_version', 'app\api\controller\Update@web_version');//web端版本

//升级包
Route::group('wgt', function () {
    Route::post('check', 'app\api\controller\Update@wgt_version');//检查更新
});

//图形验证码
Route::get('captcha', 'app\api\controller\Captcha@get');

Route::group('code', function () {
    Route::get('send_code', 'app\api\controller\Code@send_code');
    Route::get('find_pwd', 'app\api\controller\Code@find_pwd');
    Route::get('reg', 'app\api\controller\Code@reg');
    Route::get('login', 'app\api\controller\Code@login');
    Route::get('captcha', 'app\api\controller\Code@captcha');
    Route::get('bind_phone', 'app\api\controller\Code@bind_mobile');
});

Route::group('user', function () {
    Route::rule('login', 'app\api\controller\User@login', 'POST');
    Route::post('code-login', 'app\api\controller\User@code_login');
    Route::rule('register', 'app\api\controller\User@register', 'POST');
    Route::rule('logout', 'app\api\controller\User@logout', 'POST');
    Route::rule('info', 'app\api\controller\User@info', 'GET');
    Route::put('profile', 'app\api\controller\User@update');//更新用户信息
    Route::put('updateAccount', 'app\api\controller\User@update_account');//更新登录账号
    Route::put('updatePwd', 'app\api\controller\User@update_password');//更新密码
    Route::put('update-email', 'app\api\controller\User@update_email');//更新邮箱
    Route::post('cancel-account', 'app\api\controller\User@account_cancel');//注销
    Route::post('regret-cancel', 'app\api\controller\User@regret_cancel');//注销-撤回
    Route::post('forget_pwd', 'app\api\controller\User@forget_pwd');//找回密码
    Route::get('center', 'app\api\controller\User@center');//会员中心信息
    Route::post('update-phone', 'app\api\controller\User@update_phone');
});

//上传相关
Route::group('upload', function () {
    Route::rule('image', 'app\api\controller\Upload@image', 'POST');//图片上传
    Route::rule('file', 'app\api\controller\Upload@file', 'POST');
});

//轮播图
Route::group('banner', function () {
    Route::rule('list', 'app\api\controller\Banner@list', 'GET');
});

Route::group('coupon', function () {
    Route::get('list', 'app\api\controller\Coupon@list');
    Route::get('my_coupon', 'app\api\controller\Coupon@my_list');
    Route::get('detail', 'app\api\controller\Coupon@detail');
    Route::post('getCoupon', 'app\api\controller\Coupon@get_coupon');
});

//首页
Route::group('Home', function () {
    Route::get('index', 'app\api\controller\Home@index');
    Route::get('base_info', 'app\api\controller\Home@base_info');
});

Route::group('goods', function () {
    Route::get('list', 'app\api\controller\Goods@list');
    Route::get('detail', 'app\api\controller\Goods@detail');
    Route::get('category', 'app\api\controller\Goods@category');
    Route::post('collect', 'app\api\controller\Goods@collect_action');
    Route::get('collect_list', 'app\api\controller\Goods@collect_list');
});

Route::group('cart', function () {
    Route::get('list', 'app\api\controller\Cart@list');
    Route::post('action', 'app\api\controller\Cart@action');
    Route::delete('remove', 'app\api\controller\Cart@delete');
    Route::rule('checkout', 'app\api\controller\Cart@checkout', 'POST|GET');
});

Route::group('address', function () {
    Route::get('list', 'app\api\controller\Address@list');
    Route::get('detail', 'app\api\controller\Address@detail');
    Route::post('action', 'app\api\controller\Address@action');
    Route::post('setDefault', 'app\api\controller\Address@default');
    Route::delete('remove', 'app\api\controller\Address@delete');
});

Route::group('order', function () {
    Route::get('list', 'app\api\controller\Order@list');
    Route::get('detail', 'app\api\controller\Order@detail');
    Route::post('create', 'app\api\controller\Order@create');
    Route::post('cancel', 'app\api\controller\Order@cancel');
    Route::delete('remove', 'app\api\controller\Order@delete');
    Route::post('confirm', 'app\api\controller\Order@confirm');
    Route::post('refund', 'app\api\controller\Order@refund');
    Route::get('data_count', 'app\api\controller\Order@data_count');
    Route::post('remain_check', 'app\api\controller\Order@remain_check');
    Route::get('express', 'app\api\controller\Order@express');
    Route::get('pay_check', 'app\api\controller\Order@pay_check');
});

Route::group('payment', function () {
    Route::get('list', 'app\api\controller\Payment@payment_list');
    Route::post('pay', 'app\api\controller\Payment@pay');
    Route::get('cashier', 'app\api\controller\Payment@cashier');
    Route::get('cashier_query', 'app\api\controller\Payment@cashier_query');
    Route::post('cashier_pay', 'app\api\controller\Payment@cashier_pay');
});

//支付回调
Route::group('notify', function () {
    Route::rule('alipay', 'app\api\controller\Notify@alipay_pay', 'POST|GET');
    Route::rule('wechat', 'app\api\controller\Notify@wechat_pay', 'POST|GET');
});

Route::group('h5', function () {
    Route::get('check_version', 'app\api\controller\Home@h5_check_version');//版本落地页
    Route::get('article_info', 'app\api\controller\Home@article_info');
});

Route::group('comment', function () {
    Route::get('list', 'app\api\controller\Comment@list');
    Route::get('detail', 'app\api\controller\Comment@detail');
    Route::get('ready', 'app\api\controller\Comment@ready');
    Route::post('create', 'app\api\controller\Comment@create');
    Route::delete('remove', 'app\api\controller\Comment@delete');
});

Route::group('msg', function () {
    Route::get('list', 'app\api\controller\Msg@list');
    Route::get('detail/:id', 'app\api\controller\Msg@detail');
    Route::post('read-all', 'app\api\controller\Msg@read_all');
});

Route::group('feedback', function () {
    Route::get('list', 'app\api\controller\Feedback@list');
    Route::post('action', 'app\api\controller\Feedback@action');
});

//退款
Route::group('refund', function () {
    Route::get('ready', 'app\api\controller\Refund@ready');
    Route::rule('save', 'app\api\controller\Refund@save', 'POST|PUT');
});

//聊天
Route::group('chat', function () {
    Route::get('list', 'app\api\controller\Chat@chat_list');
    Route::get('ready', 'app\api\controller\Chat@ready');
    Route::post('msg', 'app\api\controller\Chat@msg');
    Route::get('conversations', 'app\api\controller\Chat@conversations');
});

//充值
Route::group('recharge', function () {
    Route::get('list', 'app\api\controller\Recharge@history');
    Route::get('detail', 'app\api\controller\Recharge@detail');
    Route::post('pay', 'app\api\controller\Recharge@pay');
    Route::get('ready', 'app\api\controller\Recharge@ready');
});

//日志
Route::group('log', function () {
    Route::get('credit', 'app\api\controller\Log@credit_list');//余额记录
    Route::get('point', 'app\api\controller\Log@point_list');//积分记录
});

//发票管理
Route::group('invoice', function () {
    Route::get('list', "app\api\controller\auto\Invoice@list");
    Route::get('detail', "app\api\controller\auto\Invoice@detail");
    Route::post('action', "app\api\controller\auto\Invoice@action");
    Route::delete('remove', "app\api\controller\auto\Invoice@delete");
    Route::put('setDefault', "app\api\controller\auto\Invoice@default");
    Route::get('list_options', "app\api\controller\auto\Invoice@list_options");
});


